/***************************************************************************\
 * The Mattise Kernel														*
 * Copyright 2007 Matthew Iselin											*
 * Licensed under the GPL													*
 *																			*
 * portio.c																	*
 *																			*
 * CPU Port I/O																*
 *																			*
\***************************************************************************/

// Includes
#include <portio.h>

// Function Implementations
inline void mlib_outportb( short p, char d ) { __asm__ __volatile__ ( "outb %1,%0" : : "dN" (p), "a" (d) ); };
inline void mlib_outportw( short p, short d ) { __asm__ __volatile__ ( "outw %1,%0" : : "dN" (p), "a" (d) ); };
inline void mlib_outportl( short p, int d ) { __asm__ __volatile__ ( "outl %1,%0" : : "dN" (p), "a" (d) ); };

inline char mlib_inportb( short p ) { char d; __asm__ __volatile__ ( "inb %1, %0" : "=a" (d) : "dM" (p) ); return d; };
inline short mlib_inportw( short p ) { short d; __asm__ __volatile__ ( "inw %1, %0" : "=a" (d) : "dM" (p) ); return d; };
inline int mlib_inportl( short p ) { int d; __asm__ __volatile__ ( "inl %1, %0" : "=a" (d) : "dM" (p) ); return d; };

